package com.lmpop.updateHtml.updateHtml;

import com.lmpop.trade.ti_channel.Ti_channelInfo;
import com.lmpop.updateHtml.parseHtml.UpdateHtml;
import java.util.Hashtable;
import java.util.List;

public class UpdateIndexHtml
{
  public void updateIndexHtml(String index_temp, String save_dir, String default_page)
  {
    UpdateHtml updateHtml = new UpdateHtml();
    updateHtml.updateWeb(index_temp, save_dir, default_page, new Hashtable());
  }

  public void updateChHtml(String ch_id)
  {
    String index_temp = ""; String save_dir = ""; String default_page = "";
    Ti_channelInfo ti_channelInfo = new Ti_channelInfo();
    List list = ti_channelInfo.getListByPk(ch_id);
    if ((list != null) && (list.size() > 0))
    {
      Hashtable map = new Hashtable();
      map = (Hashtable)list.get(0);
      if (map.get("save_dir") != null) save_dir = map.get("save_dir").toString();
      if (map.get("index_temp") != null) index_temp = map.get("index_temp").toString();
      if (map.get("default_page") != null) default_page = map.get("default_page").toString();
    }
    UpdateHtml updateHtml = new UpdateHtml();
    updateHtml.updateWeb(index_temp, save_dir, default_page, new Hashtable());
  }

  public void updateContentHtml(String ch_id)
  {
    String index_temp = ""; String save_dir = ""; String default_page = "";
    Ti_channelInfo ti_channelInfo = new Ti_channelInfo();
    List list = ti_channelInfo.getListByPk(ch_id);
    if ((list != null) && (list.size() > 0))
    {
      Hashtable map = new Hashtable();
      map = (Hashtable)list.get(0);
      if (map.get("save_dir") != null) save_dir = map.get("save_dir").toString();
      if (map.get("index_temp") != null) index_temp = map.get("index_temp").toString();
      if (map.get("default_page") != null) default_page = map.get("default_page").toString();
    }
    UpdateHtml updateHtml = new UpdateHtml();
    updateHtml.updateWeb(index_temp, save_dir, default_page, new Hashtable());
  }

  public static void main(String[] args) {
    new UpdateIndexHtml().updateIndexHtml("/src/MyHtml.html", "/src/", "index.html");
  }
}